package com.lzb.permanentcalendar.adapter;

import android.graphics.Color;
import android.view.View;

import androidx.annotation.NonNull;

import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.lzb.permanentcalendar.R;
import com.lzb.permanentcalendar.basic.ProviderMultiAdapter;
import com.lzb.permanentcalendar.bean.SxBean;

public class SxSelAdapter extends ProviderMultiAdapter<SxBean> {

    public SxSelAdapter() {
        addItemProvider(new FestivalProvider());
    }

    private class FestivalProvider extends BaseItemProvider<SxBean> {
        @Override
        public int getItemViewType() {
            return ProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_sx_sel;
        }

        @Override
        public void convert(@NonNull BaseViewHolder baseViewHolder, SxBean bean) {
            baseViewHolder.setText(R.id.tvSxSelItemName, bean.getName());
            if (bean.isSelected()){
                baseViewHolder.setTextColor(R.id.tvSxSelItemName, Color.parseColor("#AD2419"));
                baseViewHolder.getView(R.id.ivSxSelItemSel).setVisibility(View.VISIBLE);
            }else {
                baseViewHolder.setTextColor(R.id.tvSxSelItemName, Color.parseColor("#999999"));
                baseViewHolder.getView(R.id.ivSxSelItemSel).setVisibility(View.GONE);
            }
        }
    }

}
